<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/interno.xhtml">
	<ui:define name="tiulo">
	Orcamento
	</ui:define>
	<ui:define name="corpo">
		<h:form id="form">

			<p:growl id="msgs" />
			<p:panel header="Orcamento" style="width:580px">
				<h:panelGrid columns="2">

					<h:outputLabel value="Orçamento Nº:" />
					<h:outputText value="#{orcamentoMB.orcamento.id}" />

					<h:outputLabel value="Data:" />
					<h:outputText value="#{orcamentoMB.orcamento.data}" >
					<f:convertDateTime dateStyle="medium"/>
					</h:outputText>

					<h:outputLabel value="Cliente:" />
					<h:outputLabel value="#{orcamentoMB.orcamento.cliente}"/>
				</h:panelGrid>

			</p:panel>

		

			<p:panel header="Itens Orcamento" style="width:580px" id="itens">
				<p:dataTable id="tabela_itens" value="#{orcamentoMB.listaItens}"
					var="item" emptyMessage="Nenhum Item Selecionado">

					<p:column>
						<f:facet name="header">
							<h:outputText value="Código" />
						</f:facet>
						<h:outputText value="#{item.codigo}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Quantidade" />
						</f:facet>
						<h:outputText value="#{item.quantidade}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Preço" />
						</f:facet>
						<h:outputText value="#{item.valor}" />
					</p:column>

					
				</p:dataTable>

			</p:panel>

			<p:panel style="width:580px">
				<div align="right">
					<h:outputLabel value="Valor Total:"
						style="font-size:22px;font-style:bold" />
					&nbsp;
					<h:outputText value="#{orcamentoMB.totalOrc}" id="total"
						style="font-size:22px;font-style:bold" />
					<p:poll interval="1" listener="#{orcamentoMB.atualizaTotal}"
						update="total" />
				</div>

				<h:panelGrid columns="2">
					<h:outputLabel value="Condição de Pagamento:" />
					<h:outputText value="#{orcamentoMB.orcamento.prazoPagamento}" />

					<h:outputLabel value="Observações:" />
					<h:outputText  style="width:300px"
						value="#{orcamentoMB.orcamento.observacao}" />

				</h:panelGrid>

				<p:commandButton
						action="/paginas/orcamento/listar_orcamentos.xhtml"
						value="Voltar" style="width:100px" />
			</p:panel>


		</h:form>
	</ui:define>


</ui:composition>
</html>